<!--
**********************************************************
* @Author: 张小平
* @Date:   2024-05-01
* @Email:  qqshuqian@163.com
* @Last modified: 最后修改日期
* @Description: 文件描述
**********************************************************
-->
<template>

    <div  v-html="renderData(html)">
    </div>
</template>

<script>

    export default {
        name: 'Jrhtml',
        inject: ['getViewFormData'],
        props: {
            html: {
                default: () => {
                    return ''
                }
            }
       },
        computed: {
            injectedData() {
                return this.getViewFormData()
            }
        },
        methods: {
            renderData(data) {
                if(!data){
                    return data;
                }
                var formData = this.getViewFormData();
                const result = data.replace(/{{(\w+)}}/g, (match, key) =>formData?(formData[key] ||""):"");
                return  result;
            }
        }
    }
</script>


<style lang="scss" scoped>
    .content {
        background: #f7f7f7;
        padding: 5px 10px;
        > ul {
            padding: 0 !important;
            li {
                list-style: none;
                span {
                    color: #409eff;
                }
            }
        }
    }
</style>
